package com.zilue.payment.gateway.domain;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by zilue on 2017/3/8.
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PayOrderDO {
    public static final Integer STATUS_WAIT_FOR_PAY = 0;
    public static final Integer STATUS_SUCCESS = 1;
    public static final Integer STATUS_CANCLE = 2;
    public static final Integer STATUS_CLOSED = 3;
    public static final Integer STATUS_REFUND = 4;
    public static final Map<Integer, String> STATUS_MAP;

    static {
        Map<Integer, String> map = new HashMap<Integer, String>();
        map.put(STATUS_WAIT_FOR_PAY, "WAIT_FOR_PAY");
        map.put(STATUS_SUCCESS, "SUCCEEDED");
        map.put(STATUS_CANCLE, "CANCELED");
        map.put(STATUS_CLOSED, "CLOSED");
        map.put(STATUS_REFUND, "REFUNDED");
        STATUS_MAP = map;
    }

    private Long id;
    private String orderNo;
    private String outTradeNo;
    private String outPayNo;
    private String accountId;
    private String accountName;
    private Long corpId;
    private Long subCorpId;
    private String subject;
    private Long totalAmount;
    private Long refundFee;
    private String terminalId;
    private String operatorId;
    private String storeId;
    private String goodsDetail;
    private Integer status;
    private Long payScene;
    private Long optType;
    private Date createDate;
    private Date updateDate;
    private Date payDate;
}

enum OrderStatusEnum {
    WAIT_FOR_PAY(0, "待支付(wait to pay)"),
    STATUS_SUCCESS(1, "支付成功(pay success)"),
    STATUS_CANCLE(2, "已取消(cancled)"),
    STATUS_CLOSED(3, "已关闭(closed)"),
    STATUS_REFUND(4, "已退费(refunded)");

    private Integer status;
    private String detail;

    OrderStatusEnum(Integer status, String detail) {
        this.status = status;
        this.detail = detail;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getDetail() {
        return detail;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }
}
